package com.qmds.userserver.user.controller;

import com.qmds.common.core.annotation.NoLoginCheck;
import com.qmds.common.core.vo.R;
import com.qmds.userserver.user.param.LoginParam;
import com.qmds.userserver.user.service.LoginService;
import com.qmds.userserver.user.vo.UserVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * --- 代码敲烂 月薪过万 ---
 *
 * @author ShiJiaWei
 * @date 2024/9/7
 * @desc:
 */
@RestController
@RequestMapping("/app/user")
public class LoginController {

    @Resource
    private LoginService loginService;

    @PostMapping("/login")
    @NoLoginCheck
    public R<String> login(@RequestBody LoginParam loginParam) {
        return loginService.login(loginParam);
    }

    @GetMapping("/info")
    public R<UserVo> getUserInfo(String token) {
        return loginService.getUserInfo(token);
    }

    @PostMapping("/logout")
    public R<String> logout() {
        return R.ok("退出成功！", null);
    }
}
